Skip to content

Improvements to FooConfigOption#495

Merged
arichardson merged 11 commits into
mainfrom
config-setup
May 27, 2026
Merged

Improvements to FooConfigOption#495
arichardson merged 11 commits into
mainfrom
config-setup

Conversation

@arichardson
Copy link
Copy Markdown
Member

Allows using them instead of cls.setup_config_options() (#493 )

We can't pass Optional[] as the parameter since it can't be used as a
callable, we have to pass the actual type instead.
Needed to replace the calls to add_config_option.
This adds OptionalEnumConfigOption to the declarative options framework,
permitting Enum option declarations that do not require an initial default
value and default to None. This mirrors the existing OptionalIntConfigOption,
OptionalStringConfigOption, and OptionalPathConfigOption classes.
…iptors

This implements generic option mixin registration by dynamically injecting option dictionaries on parent mixin classes. The metaclass is updated to merge base class options from all parents to correctly support multiple inheritance hierarchies, and it now prunes any descriptors that are overridden as static non-descriptor values in subclasses.

This also adds a comprehensive unit test in tests/test_project_helpers.py verifying correct option resolution and inheritance across mixins and subclasses.
This introduces a declarative extra_condition callback parameter to the
PerProjectConfigOption constructor. Subclasses option registry (MRO walk
in the ProjectSubclassDefinitionHook.__init__ metaclass) evaluates this
condition at class creation time and prunes the option if the condition
evaluates to False on the class. Instead we just populate the class
member with a descriptor that returns the default value.
Checks if an option is inherited as a ConfigOptionHandle from a
concrete parent class, and registers it target-specifically on the
subclass if it has not been registered directly yet. This fixes a
bug where subclass target classes of concrete parent target classes did
not register any of their parent classes' options.

For example, BuildCheriAllianceQEMU (cheri-std093-qemu) inherits
'targets' option from BuildQEMU (qemu), and we must register it
specifically so it resolves to the custom default_targets list.

Also adds a test in test_project_helpers.py to verify option
registration.
@arichardson arichardson enabled auto-merge (rebase) May 27, 2026 18:36
@arichardson arichardson merged commit d417c6b into main May 27, 2026
8 of 9 checks passed
@arichardson arichardson deleted the config-setup branch May 27, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant